package com.leeoohoo.base;

import com.oohoo.spacestationspringbootstarter.dto.query.annotation.*;
import jakarta.persistence.Column;
import jakarta.persistence.Convert;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;
import lombok.Data;
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters;

import java.time.LocalDateTime;

/**
 * @Description:
 * @Author: lei.d.li@capgemini.com
 * @CreateTime: 2023/1/31
 */
@Data
@MappedSuperclass
public class BaseEntity {

    @Id
    private Long id;

    @CreateBy
    private String createBy;

    @CreateTime
    @Convert(converter = Jsr310JpaConverters.LocalDateTimeConverter.class)
    private LocalDateTime createTime;

    @LastUpdateBy
    private String lastUpdateBy;

    @LastUpdateTime
    @Convert(converter = Jsr310JpaConverters.LocalDateTimeConverter.class)
    private LocalDateTime lastUpdateTime;

    @Deleted
    @Column(columnDefinition = "int default 0")
    private Integer deleted;
}
